<?php
/*
 * @Descripttion: 
 * @Author: dedeye
 * @Date: 2020-02-25 16:15:10
 * @LastEditors: dedeye
 * @LastEditTime: 2020-03-01 14:54:23
 */
// +----------------------------------------------------------------------
// | ThinkPHP [ WE CAN DO IT JUST THINK ]
// +----------------------------------------------------------------------
// | Copyright (c) 2006~2018 http://thinkphp.cn All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------
// | Author: liu21st <liu21st@gmail.com>
// +----------------------------------------------------------------------

Route::get('verify', 'admin/login/verify'); // 验证码
Route::group('admin', function () {
    Route::get('/', 'admin/index/index'); // 后台主页
    Route::rule('login', 'admin/login/index', 'GET|POST'); // 登录
    Route::get('logout', 'admin/index/logout'); // 登出

    // 初始化
    Route::get('init', 'admin/index/init');
    // 主页
    Route::get('welcome', 'admin/index/welcome');

    // admin
    Route::group('user', function () {
        Route::get('/', 'admin/admin/index'); // 显示用户列表页 和返回数据
        Route::rule('add', 'admin/admin/create', 'GET|POST'); // 显示添加页面和添加接口
        Route::rule('edit', 'admin/admin/edit', 'GET|POST'); // 显示编辑页面和编辑接口
        Route::get('read/:id', 'admin/admin/read')->pattern(['id' => '\d+']); // 查询单个数据
        Route::delete('del/:id', 'admin/admin/delete')->pattern(['id' => '\d+']); // 删除单个数据
        // Route::post('dels', 'admin/admin/deletes'); // 删除多个

        Route::get('auth', 'admin/admin/auth');  // 授权页面
        Route::get('auth-list/:id', 'admin/admin/authlist')->pattern(['id' => '\d+']);
        Route::get('auth-add/:id/:groupid', 'admin/admin/authAdd')
                ->pattern(['id' => '\d+','groupid' => '\d+']);
        Route::delete('auth-del/:id/:groupid', 'admin/admin/authDel')
                ->pattern(['id' => '\d+','groupid' => '\d+']);
    });

    // menu
    Route::group('menu', function (){
        Route::get('/', 'admin/rule/index'); // 显示页面以及数据
        Route::get('read/:id', 'admin/rule/read')->pattern(['id' => '\d+']);
        Route::rule('edit', 'admin/rule/edit', 'GET|POST');
        Route::rule('add', 'admin/rule/create', 'GET|POST');
        Route::delete('del/:id', 'admin/rule/delete')->pattern(['id' => '\d+']);
    });

    // group
    Route::group('group', function (){
        Route::get('/', 'admin/rule_group/index'); // 显示页面以及数据
        Route::rule('add', 'admin/rule_group/create', 'GET|POST');
        Route::rule('edit', 'admin/rule_group/edit', 'GET|POST');
        Route::get('read/:id', 'admin/rule_group/read')->pattern(['id' => '\d+']);
        Route::delete('del/:id', 'admin/rule_group/delete')->pattern(['id' => '\d+']);

        Route::get('auth', 'admin/rule_group/auth');  // 授权页面
        Route::get('authtree/:id', 'admin/rule_group/authtree')->pattern(['id' => '\d+']); // 授权
        Route::post('save-auth', 'admin/rule_group/saveauth');
    });

    // 内容管理
    Route::group('content', function (){
        
    });
    Route::get('no-auth', 'admin/index/noauth');
    Route::miss('admin/miss/index');
});